/*
===========================================================================
Copyright (C) 1999-2005 Id Software, Inc.

This file is part of Quake III Arena source code.

Quake III Arena source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

Quake III Arena source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
===========================================================================
*/
//
// cg_syscalls.c -- this file is only included when building a dll
// cg_syscalls.asm is included instead when building a qvm
#ifdef Q3_VM
#error "Do not use in VM build"
#endif

#include "cg_local.h"

static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;

extern cgameExports_t exportedCGameAPI;

cgameImports_t trap;

void dllEntry( void **libAPI, const void *engineAPI )
{
	memcpy(&trap, engineAPI, sizeof(cgameImports_t));
	*libAPI = &exportedCGameAPI;
}



int PASSFLOAT( float x ) {
	float	floatTemp;
	floatTemp = x;
	return *(int *)&floatTemp;
}


// Shared stuff
int	trap_PC_ReadToken( int handle, pc_token_t *pc_token )
{
	return trap.PC_ReadToken( handle, pc_token );
}

int	trap_PC_SourceFileAndLine( int handle, char *filename, int *line )
{
	return trap.PC_SourceFileAndLine( handle, filename, line );
}

void trap_SnapVector( float *v )
{
	trap.Sys_SnapVector(v);
}

void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize )
{
	trap.Cvar_VariableStringBuffer( var_name, buffer, bufsize );
}
